/*

Use "C:\Local\数据\Table 1\Enterprise Survey Data 2005.dta"

keep if country=="China2002"|country=="China2003"

keep if sector==1

rename c262a1y pemp1

rename c263a1y temp1
	
g emp1 = pemp1 + temp1

rename c274a1y sales1

g lp = log(sales1/emp1)
g lsales = log(sales1)
g lemp = log(emp1)

//what percent of your establishment's sales - domestically/ex directly/ex indirectly 
rename c211a1 d
rename c211a2 dx
rename c211a3 ix

*** exporter ***
	g i_ix = ix~=0 & ix~=.
	g d_dx = dx~=0 & dx~=.

	g x = 0
		replace x = 1 if i_ix|d_dx

	tab i_ix d_dx if x

	foreach v of varlist lsales lemp lp {
		g `v'2 = `v'^2
		}

	foreach v of varlist d dx ix {
		replace `v' = `v'/100
		}
		
Drop idstd year country wt region income sector ownership exporter c201 c202 ///
c203a c203b c203c c203d c2041 c2042 c205a c205b1 c205b2 c205b3 c205b4 c205b5 c205b6 ///
c205b7 c205b8 c205b9 c205b10 c205c c205d c206a c206b c2071 c2072 c208 c209a c209ba c209bb ///
c209bc c209bd c209be c210a c210b d c211b1 c211b2 c211b3 c211b4 c211b5 c211b6 c211c1 c2121 ///
c2122 c2123 c213 c214 c215 c216a1 c216a2 c216a3 c216b1 c216b2 c216b3 c216c1 c216c2 c216c3 ///
c216a1w c216a2w c216a3w c216b1w c216b2w c216b3w c216c1w c216c2w c216c3w c217 c218a c218b ///
c218c c218d c218e c218f c218g c218h c218i c218j c218k c218l c218m c218n c218o c218p c218q ///
c218r c219a1 c219b1 c219c1 c219d1 c219a2 c219b2 c219c2 c219d2 c219a3 c219b3 c219c3 c219d3 ///
c220a c220b c220c c220d1 c220d2 c221a c221b c221c c222 c223 c224a c224b c225a c225ba c225bb ///
c225bc c225bd c225be c225bf c226a1 c226a2 c226a3 c226a4 c226a5 c226a6 c226a7 c226b1 c226b2 ///
c226b3 c226b4 c226b5 c226b6 c226b7 c227a1 c227b1 c227c1 c227d1 c227e1 c227f1 c227g1 c227h1 ///
c227i1 c227j1 c227k1 c227a2 c227b2 c227c2 c227d2 c227e2 c227f2 c227g2 c227h2 c227i2 c227j2 ///
c227k2 c228 c228y c229a c229b c229c1 c229c2 c229c3 c229c4 c229d c229e c229f c230 c231a1 ///
c231a2 c231a3 c231b1 c231b2 c231b3 c231c1 c231c2 c231c3 c232 c233a1 c233b1 c233a2 c233b2 ///
c233a3 c233b3 c234 c235 c236a1 c236a2 c236b1 c236b2 c237 c238 c239 c240a1 c240a2 c240a3 ///
c240a4 c240a5 c240a6 c240b1 c240b2 c240b3 c240b4 c240b5 c240b6 c240c1 c240c2 c240c3 ///
c240c4 c240c5 c240c6 c241 c242a1 c242a2 c242a3 c242a4 c242a5 c242a6 c242a7 c242b1 ///
c242b2 c242b3 c242b4 c242b5 c242b6 c242b7 c242c1 c242c2 c242c3 c242c4 c242c5 c242c6 ///
c242c7 c242d1 c242d2 c242d3 c242d4 c242d5 c242d6 c242d7 c242e1 c242e2 c242e3 c242e4 ///
c242e5 c242e6 c242e7 c243 c244a c244ba c244bb c244bc c244bd c244be c244bf c244bg ///
c244bh c244bi c244bj c244bk c245a c245b c245c c245d c246 c247a c247b c247c c247d ///
c247e c247f c247g c248a c248b c249a c249b c249c c250 c2513y c2512y c2511y c252 ///
c253a c253b c254 c255a c255b c255c c256 c257 c2581 c2582 c2583 c2584 c2585 c2586 ///
c2587 c2588 c2589 c25810 c2591 c2592 c2593 c260 c261 c262a3y c262a2y pemp1 c262a1 ///
c262a2 c262a3 c262b2y c262b1y c262b1 c262b2 c262b3 c262c2y c262c1y c262c1 c262c2 ///
c262c3 c262d2y c262d1y c262d1 c262d2 c262d3 c262e2y c262e1y c262e1 c262e2 c262e3 ///
c262f2y c262f1y c262f1 c262f2 c262f3 temp1 c263b1y c263c1y c263d1y c263a2y c263b2y ///
c263c2y c263d2y c263a3y c263b3y c263c3y c263d3y c264 c265a c265b1 c265b2 c265b3 ///
c2661 c2662 c267a c267b1 c267c1 c267b2 c267c2 c268 c269a c269b c269c c270a c270b ///
c270c c270d c270a1 c271 c272 c273 c273a c273b c273c sales1 c274b1y c274c1y c274d1y ///
c274e1y c274f1y c274g1y c274h1y c274i1y c274j1y c274k1y c274l1y c274m1y c274n1y ///
c274a2y c274b2y c274c2y c274d2y c274e2y c274f2y c274g2y c274h2y c274i2y c274j2y ///
c274k2y c274l2y c274m2y c274n2y c274a3y c274b3y c274c3y c274d3y c274e3y c274f3y ///
c274g3y c274h3y c274i3y c274j3y c274k3y c274l3y c274m3y c274n3y c275 c276a1y c276e1y ///
c276a2y c276e2y c276a3y c276e3y c276b1y c276f1y c276b2y c276f2y c276b3y c276f3y c276c1y ///
c276c2y c276c3y c276d1y c276d2y c276d3y c277a c277b c278a1y c278b1y c278c1y c278a2y ///
c278b2y c278c2y c278a3y c278b3y c278c3y c279a1y c279b1y c279c1y c279d1y c279a2y c279b2y ///
c279c2y c279d2y c279a3y c279b3y c279c3y c279d3y c280 c281a1y c281b1y c281c1y c281d1y ///
c281e1y c281f1y c281g1y c281h1y c281i1y c281j1y c281k1y c281l1y c281m1y c281n1y c281o1y ///
c281p1y c281q1y c281a2y c281b2y c281c2y c281d2y c281e2y c281f2y c281g2y c281h2y c281i2y ///
c281j2y c281k2y c281l2y c281m2y c281n2y c281o2y c281p2y c281q2y c281a3y c281b3y c281c3y ///
c281d3y c281e3y c281f3y c281g3y c281h3y c281i3y c281j3y c281k3y c281l3y c281m3y c281n3y ///
c281o3y c281p3y c281q3y c282a1y c282b1y c282c1y c282d1y c282e1y c282f1y c282a2y c282b2y ///
c282c2y c282d2y c282e2y c282f2y c282a3y c282b3y c282c3y c282d3y c282e3y c282f3y gni pop ///
country_proper c_abbr emp1 i_ix d_dx x

save "C:\Local\数据\Table 1\table 1 data.dta"

*/


/// Table 1 Panel A

areg dx lsales lsales2, a(industry)


areg dx lemp lemp2, a(industry)


areg dx lp lp2, a(industry)


/// Table 1 Panel B

areg ix lsales lsales2, a(industry)


areg ix lemp lemp2, a(industry)


areg ix lp lp2, a(industry)





